<?php
class My_GuestController extends MM_Controller_My_Action
{	
	//嘉宾库	
	/**
	 * @var MM_Service_Admin_Guests 嘉宾
	 */
	private $serviceG = null;
	
	/**
	 * 初始化
	 */
	public function init()
	{
		parent::init();		
		$this->serviceG	 = new MM_Service_Admin_Guests();
	}
	
	/**
	 * index
	 */
	public function indexAction()
	{
		$this->helper->setPageView($this->pageview, WEB_TITLE, "guestlist", null);
	}
	
	/**
	 * page
	 */
	public function pageAction()
	{
		if ( !empty($this->httpdata['act']) && isset($this->httpdata['act']) ) {
			$dt = new Mediad2_Utility_Datatable($this->serviceG);
			if(!isset($this->httpdata['ovar'])) {
				$this->httpdata['ovar'] = "addtime";
			}
			$where = "uid = $this->uid";
			$dt->init($this->httpdata['act'], array("name"),$where);
			$dt->create();
			$dt->response();
		}
	}

	public function getfileAction()
	{
		if ( ($this->uid<1 && $this->fid<1) ) {
			$this->result = $this->returnResult(Mediad2_Model_Result::CODE_FAILURE,'Miss parameter: uid');
		} else {
			$where = sprintf("fid = '%s'",$this->fid);
			$fileService = new Mediad2_Service_Admin_Files();
			$this->result = $fileService->fetchAll(null,null,$where,null,true);
		}
		echo $this->encodeResult($this->result);
	}
}